import request from '@/utils/request';

// 查询类目列表
export function listCategory(query) {
	return request({
		url: '/mall/category/list',
		method: 'post',
		data: query,
	});
}

export function getGoodsTypeList(data) {
	return request({
		url: '/mall/category/goodlist',
		method: 'post',
		data: data,
	});
}

// 查询类目详细
export function getCategory(id) {
	return request({
		url: '/mall/category/getInfo',
		method: 'post',
		data: { id: id },
	});
}

// 新增类目
export function addCategory(data) {
	return request({
		url: '/mall/category/add',
		method: 'post',
		data: data,
	});
}

// 编辑类目
export function updateCategory(data) {
	return request({
		url: '/mall/category/edit',
		method: 'post',
		data: data,
	});
}

// 删除类目
export function delCategory(id) {
	return request({
		url: '/mall/category/remove',
		method: 'post',
		data: { id: id },
	});
}

// 导出类目
export function exportCategory(query) {
	return request({
		url: '/mall/category/export',
		method: 'post',
		params: query,
	});
}

export const listParent = () => {
	return request({
		url: '/mall/category/listParent',
		method: 'post',
	});
};

export const listStoreParent = () => {
	return request({
		url: '/mall/category/listStoreParent',
		method: 'post',
	});
};

export const listChild = (id) => {
	return request({
		url: '/mall/category/listChild',
		method: 'post',
		data: id,
	});
};

export const listStoreChild = (id) => {
	return request({
		url: '/mall/category/listStoreChild',
		method: 'post',
		data: id,
	});
};

export const sortOrderReduce = (id) => {
	return request({
		url: '/mall/category/reSortOrderReduce',
		method: 'post',
		data: id,
	});
};
export const sortOrderPlus = (id) => {
	return request({
		url: '/mall/category/reSortOrderPlus',
		method: 'post',
		data: id,
	});
};
